/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.fatec.ads.classes;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;

/**
 *
 * @author Roberta Ferreira
 */
@Entity
public class Editora extends AbstractTO {

    private int codigo;
    private String nome;
    private String site;

    public Editora() {
    }

    public Editora(int codigo) {
        this.codigo = codigo;
    }

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="cd_editora", length=4)
    public int getCodigo() {
        return codigo;
    }

    public void setCodigo(int codigo) {
        this.codigo = codigo;
    }

    @Column(name="nm_editora", nullable=false, length=40)
    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    @Column(name="ds_site", length=150)
    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    @Override
    @Transient
    public Serializable getPK() {
        return this.getCodigo();
    }

    @Override
    public void setPK(Serializable identifier) {
        this.setCodigo((Integer) identifier);
    }

    @Override
    public String toString() {
        return "Editora[codigo=" + this.getCodigo() +
                            ", nome=" + this.getNome() +
                                ", site=" + this.getSite() + "]";
    }
        
}
